package com.Media.Common;

import java.util.Map;

import org.apache.struts2.util.StrutsTypeConverter;

import com.Media.bean.MyAge;

public class TypeConvert2 extends StrutsTypeConverter {

	@Override
	public Object convertFromString(Map context, String[] values, Class toClass) {
		String age = values[0];
		MyAge myAge = new MyAge();
		myAge.setAge(Integer.parseInt(age));
		return myAge;
	}

	@Override
	public String convertToString(Map context, Object o) {
		MyAge myAge = (MyAge)o;
		return String.valueOf(myAge.getAge()-1);
	}

}
